package org.zsl.service;

import org.springframework.web.bind.annotation.RequestMapping;
import org.zsl.model.Employee;
import org.zsl.model.ResponseMsg;

import java.util.ArrayList;
import java.util.List;

public class EmployeeService {

    public ResponseMsg getAll(){

        List<Employee> list = new ArrayList<>();
        ResponseMsg responseMsg = new ResponseMsg();

        for (int i = 0; i < 5; i++) {

            Employee emp= new Employee();
            emp.setName("员工"+i);
            emp.setDept("部门"+i);
            // 怎么处理性别 ，随机数

            list.add(emp);
        }


         responseMsg.setData(list);


        return  responseMsg;
    }


    public  Employee getEmployeeById(int id){

        Employee employee = new Employee();
        employee.setId(id);
        employee.setName("员工1");

        return  employee;

    }

    public ResponseMsg delelteEmployee(int id){

        ResponseMsg responseMsg = new ResponseMsg();

        responseMsg.setSuccess(true);

        return  responseMsg;

    }


    public ResponseMsg add(Employee employee){

        // 把 employee 添加到数据库

        ResponseMsg responseMsg = new ResponseMsg();

        responseMsg.setSuccess(true);

        return  responseMsg;
    }


    public ResponseMsg update(Employee employee){
        // 把 employee的变化 添加到数据库

        ResponseMsg responseMsg = new ResponseMsg();

        responseMsg.setSuccess(true);

        return  responseMsg;
    }
}
